package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    // 根据菜品id查询套餐id
    List<Long> getSetmealIdsByDishIds(List<Long> ids);

    // 向setmeal_dish表插入套餐菜品关联记录
    @AutoFill(value = OperationType.INSERT)
    void insertBatch(List<SetmealDish> setmealDishes);

    // 删除套餐-菜品关联的记录
    void deleteByIds(List<Long> ids);

    // 根据套餐id查询菜品和套餐的关联关系
    @Select("select * from setmeal_dish where setmeal_id=#{setmealId}")
    List<SetmealDish> getBySetmealId(Long setmealId);
}
